# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=prjtrellis-db
pkgver=0_git20230929
_commit=4dda149b9e4f1753ebc8b011ece2fe794be1281a
pkgrel=0
pkgdesc="Project Trellis database"
url="https://github.com/YosysHQ/prjtrellis-db"
arch="noarch"
license="CC0-1.0"
source="
	$pkgname-$_commit.tar.gz::https://github.com/YosysHQ/prjtrellis-db/archive/$_commit.tar.gz
	"
subpackages="
	$pkgname-ecp5
	$pkgname-machxo
	$pkgname-machxo2
	$pkgname-machxo3
	$pkgname-machxo3d
	"
options="!check" # no unit tests provided
builddir="$srcdir/prjtrellis-db-$_commit"

package() {
	local _destdir="$pkgdir"/usr/share/trellis/database
	install -dm 755 "$_destdir"
	cp -r \
		devices.json \
		ECP5 \
		MachXO \
		MachXO2 \
		MachXO3 \
		MachXO3D \
		"$_destdir"
}

_subpkg() {
	local _platform="$1"
	pkgdesc="Project Trellis database for $_platform"
	depends="$pkgname"
	amove usr/share/trellis/database/"$_platform"

}

ecp5() {
	_subpkg ECP5
}

machxo() {
	_subpkg MachXO
}

machxo2() {
	_subpkg MachXO2
}

machxo3() {
	_subpkg MachXO3
}

machxo3d() {
	_subpkg MachXO3D
}

sha512sums="
e2e6d37ad93c082f97033288299c045138aebe3bb0ab0169545c0a7ee64a8b408007475ebb94b756378b1e51c3621c89f94b857d2bb9eec0d77bfea5ac7ebe4c  prjtrellis-db-4dda149b9e4f1753ebc8b011ece2fe794be1281a.tar.gz
"
